import request from './requset'

// 获取用户数据列表
export const getUsers = (params) => {
  return request({
    url: '/users',
    method: 'GET',
    params
  })
}

// 添加用户
export const addUser = (data) => {
  return request({
    url: '/users',
    method: 'POST',
    data
  })
}

// 修改用户状态
export const changeUserState = (uId, type) => {
  return request({
    url: `users/${uId}/state/${type}`,
    method: 'PUT'
  })
}

// 编辑用户
export const editUser = (data) => {
  return request({
    url: `users/${data.id}`,
    method: 'put',
    data
  })
}

// 删除用户
export const delUser = (id) => {
  return request({
    url: `users/${id}`,
    method: 'delete'
  })
}
